/*
 * @Description: 
 * @Autor: zhangzhanhua
 * @Date: 2021-07-16 18:28:38
 * @LastEditors: zhangzhanhua
 * @LastEditTime: 2021-07-17 17:39:48
 */
// 设置 rem 函数
export default function setRem() {
    //     // 320 默认大小16px; 320px = 20rem ;每个元素px基础上/16
    //     let htmlWidth = document.documentElement.clientHeight || document.body.clientHeight;
    // //得到html的Dom元素
    let htmlDom = document.querySelector('#bigScreen');
    // //设置根元素字体大小
    //     htmlDom.style.fontSize= 20 * (htmlWidth / 1100) + 'px';
    //     console.log(20 * (htmlWidth / 1100) + 'px');
    let docEle = document.documentElement;
    let screenRatioByDesign = 16 / 9
    let screenRatio = docEle.clientWidth / docEle.clientHeight;
    let fontSize = ((screenRatio > screenRatioByDesign ? screenRatioByDesign / screenRatio : 1) * docEle.clientWidth) / 100;
    htmlDom.style.fontSize = fontSize.toFixed(3) + "px";
}
// // 初始化
// setRem();
// // 改变窗口大小时重新设置 rem
// window.onresize = function () {
//     setRem()
// }